/*
#include <iostream>
using namespace std;

void print(int* array, int n);
void quicksort(int* array, int start, int end);
int splitArray(int* array, int pivot, int start, int end);
void swap(int &a, int &b);

void quicksort(int * array, int start, int end)
{
    int pivot = array[start];
    int split;
    if(end > start)
    {
        split = splitArray(array, pivot, start, end);
        array[split] = pivot;
        quicksort(array, start, split-1);
        quicksort(array, split+1, end);
    }
}

int splitArray(int * array, int pivot, int start, int end)
{
    int left = start;
    int right = end;
    while(left < right)
    {
        while(pivot < array[right] && right > left)
        {
            right--;
        }
        swap(array[left], array[right]);
        while(pivot >= array[left] && left < right)
        {
            left++;
        }
        swap(array[right], array[left]);
    }
    return left;
}

void swap(int &a, int &b)
{
    int temp;
    temp = a;
    a = b;
    b = temp;
}

void print(int * array, int size)
{
    for(int i = 0; i < size; i++)
    {
        cout << array[i] << " ";
    }
    cout << endl;
}

void selectionsort(int * array, int size)
{
    for(int i = 0; i < size; i++)
    {
        for(int j = i + 1; j < size; j++)
        {
            if(array[j] < array[i])
            {
                swap(array[j], array[i]);
            }
        }
    }
}

int main()
{
    int array[] = {1,5,2,7,4,8,2,3,5,1,77};
    int size = sizeof (array) / sizeof(int);
    print(array, size);
    //selectionsort(array, size);
    quicksort(array, 0, size - 1);
    print(array, size);
}
*/
